<template>
  <!--招采管理-班组招采列表-上传会签表弹窗和表单-->
    <j-modal
      title="上传会签表"
      :width="width"
      :visible="visible"
      switchFullscreen
      @ok="handleOk"
      @cancel="handleCancel"
      cancelText="取消"
      okText="上传会签表"
    >
    <a-spin :spinning="confirmLoading">
    <a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model" :rules="validatorRules">
      <!-- 主表单区域 -->
      <a-row class="form-row" :gutter="16">
        <a-col :lg="3">
              <a-form-item label="发标时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                <a-input
                  v-model="issueTime"
                  :showTime="true"
                 disabled
                  style="width: 85%"
                ></a-input>

              </a-form-item>
            </a-col>
            <a-col :lg="4">
              <a-form-item label="结标时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                <a-input
                  v-model="traneIncTime"

                  :showTime="true"
                  disabled
                  style="width: 75%;margin-left: -10px;"
                ></a-input>

              </a-form-item>
            </a-col>
        <a-col :lg="8">
            <a-form-model-item label="招标名称" prop="name">
              <a-input  v-model="model.name" placeholder="请输入招标名称" />
            </a-form-model-item>
          </a-col>


          <a-col :lg="8">
            <a-form-model-item label="中标班组" prop="supplierId">
              <a-select :options="supplierList"  v-model="supplierId" placeholder="请选择中标班组" ></a-select>
              <!-- <j-multi-select-tag :options="supplierList" mode="multiple" v-model="model.supplierId" placeholder="请输入型号" style="overflow: hidden;">
              </j-multi-select-tag> -->
            </a-form-model-item>
          </a-col>
        <a-col :span="8" style="margin-right: -250px">
          <a-form-model-item label="会签文件(上传文件)" prop="fileList">
            <j-upload v-model="countersignUrl"></j-upload>
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
    </a-spin>
    </j-modal>
  </template>

  <script>
  import { httpAction, getAction } from '@/api/manage'
//   import { mixinDevice } from '@/utils/mixin'
// import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getFileAccessHttpUrl } from '@/api/manage'
import { axios } from '@/utils/request'
import signMd5Utils from '@/utils/encryption/signMd5Utils'
  export default {
    // mixins: [JeecgListMixin, mixinDevice],

    components: {
    },
    props:{
      traneIncTime:{
        type:String
      },
      issueTime:{
        type:String
      },
      id:{
        type:String
      }
    },
    data() {
      return {
        publicBiddingId:'',
        title: '上传会签表',
        width: 1100,
        visible: false,
        traneIncTime:'',
        issueTime:'',
        disableSubmit: true,
        confirmLoading: false,
        loading: false,
        model:{

        },
        countersignUrl:[],

        supplierId:'',
        supplierList:[],
        treeData:[],

      queryParam: { type: '1',publicBiddingId:this.id },
      }
    },
    created() {

  },
    computed:{

    },

    methods: {
      add() {
        this.visible = true

      },
      supper(){
        // console.log('434',this.supplierId);
      },
      edit(record) {
        this.visible = true;

        let url  = "/bidding/wtPublicBidding/getCountersignData"
      let parameter  = {
        publicBiddingId: record.id
      }
      let sign = signMd5Utils.getSign(url, parameter);

      let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getTimestamp()};

      axios({
        url: url,
        method:'get' ,
        params: parameter,
        headers: signHeader
      }).then((res) => {
        var dataInfo = res.result.list
        this.supplierList=[...dataInfo].map((v) => {
            return {
             ...v,
              value: v.id,
              label: v.supplierName,
            }
          }
          )


      })
      this.model = Object.assign(

        record
      )

      this.visible = true
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      handleCancel() {
        this.close()
      },
      handleOk() {
      this.visible = true
      this.confirmLoading = true
      this.imageUrl = getFileAccessHttpUrl(this.countersignUrl)
      // console.log('4565',this.imageUrl);
      // debugger
      httpAction(
        '/bidding/wtPublicBidding/updateBidding',
        {
          id: this.id,
          biddingSuppliers:this.supplierId,
          biddingSupplierStatus: '3',
          status: '4',
          countersignUrl:this.imageUrl
        },
        'POST'
      )
        .then((res) => {
          this.countersignData = res.result
        })
        .finally(() => {
          this.confirmLoading = false
          this.close()
          this.visible = false
          this.$emit('handleOk');
        })
        this.fileList=[]
      // console.log(record.id)
    }
    },
  }
  </script>
  <style scoped>
  .div1 {
    width: 100%;
    text-align: center;
    font-size: 16px;
  }
  </style>